﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Platformer
{
    public class Block
    {
        Texture2D texture;

        public Vector2 Position
        {
            set { position = value; }
            get { return position; }
        }
        Vector2 position;

        // Size of the player sprite
        public static Point Size
        {
            get { return size; }
        }
        static Point size = new Point((int)(40 * 1.6f), (int)(32 * 1.6f));

        public static float Scale
        {
            get { return scale; }
        }
        static float scale = 1.6f;

        // Rect of the player sprite
        public Rectangle Rect
        {
            get { return rect; }
        }
        Rectangle rect;

        public Block(ContentManager Content, Vector2 position, int rand)
        {
            this.position = position;
            rect = new Rectangle((int)position.X, (int)position.Y, size.X, size.Y);

            if (rand < 0 || rand > 6)
                texture = Content.Load<Texture2D>("Blocks/BlockA0");
            else
                texture = Content.Load<Texture2D>("Blocks/BlockA" + rand);

        }

        public void Update()
        {
            rect = new Rectangle((int)position.X, (int)position.Y, size.X, size.Y);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, position, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
        }
    }
}
